package com.yc.home.cloudother.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.entity.Classs;
import com.yc.entity.Createclass;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lzk
 * @since 2024-10-05
 */
public interface ClasssMapper extends BaseMapper<Classs> {

    @Select("select * from createclass where id in (select cid from classs where uid = #{uid} and status = 1) and status = 1")
    List<Createclass> classinfo(String uid);

    @Select("select * from createclass where id in (select cid from classs where uid = #{uid} and status in (1, 2)) and cname like concat('%', #{search}, '%') and status = 1")
    List<Createclass> getclass(@Param("uid") String uid, @Param("search") String search);

    @Select("select * from (select cid,status from classs where uid = #{id}) as a left join createclass on a.cid = createclass.id")
    List<Map<String, String>> getRecord(String id);

    @Select("select pic from user where id = #{uid}")
    String getimage(@Param("uid") String uid);
}
